const TokenKey = 'token'
// const ThemeKey = 'theme'
// const AppIdKey = 'appId'
// const SpidKey = 'spid'
const AppKey = 'appInfo'

export function getToken() {
    return localStorage.getItem(TokenKey)
}

export function setToken(token) {
    localStorage.setItem(TokenKey, token)
}

export function removeToken() {
    localStorage.removeItem(TokenKey)
}

export function getAppInfo() {
    let Obj = {}
    try {
        if (localStorage.getItem(AppKey) !== null) {
            Obj = JSON.parse(localStorage.getItem(AppKey))
        }
    } catch (e) {
        console.log(e)
    }
    return Obj
}

export function setAppInfo(appInfo) {
    if (typeof appInfo === 'object' && isNaN(appInfo.length)) {
        appInfo = JSON.stringify(appInfo)
    }
    return localStorage.setItem(AppKey, appInfo)
}

export function removeAppInfo() {
    return localStorage.removeItem(AppKey)
}

